package parameter

import (
	"gf-assistant/internal/common"
	"github.com/gogf/gf/v2/frame/g"
)

type GetProjectReq struct {
	g.Meta    `path:"/get" method:"post"`
	ProjectId int32 `p:"ProjectId"  d:"1" v:"required#项目Id必填" dc:"项目ID"`
}

type GetProjectRes struct {
	ProjectId        uint   `json:"projectId" dc:"项目ID"`
	ProjectCode      string `json:"projectCode"  dc:"项编码称"   `
	ProjectName      string `json:"projectName"  dc:"项目名称"   `
	ProjectUrl       string `json:"projectUrl"  dc:"项目Url"   `
	LeaderId         uint   `json:"leaderId" dc:"项目负责人Id"    `
	LeaderName       string `json:"leaderName" dc:"项目负责人"    `
	Remark           string `json:"remark" dc:"备注"    `
	EnableStatus     uint   `json:"enableStatus"  dc:"有效状态：0-无效，1-有效"     `
	EnableStatusName string `json:"enableStatusName"  dc:"状态名称"    `
	CreatedUserName  string `json:"createdUserName"  dc:"创建人" `
	CreatedTime      string `json:"createdTime"   dc:"创建时间"`
	UpdatedTime      string `json:"updatedTime"  dc:"修改时间" `
	UpdatedUserName  string `json:"updatedUserName"  dc:"修改人" `
}

type ListProjectReq struct {
	g.Meta       `path:"/list" method:"post"`
	ProjectName  string `json:"projectName" dc:"项目名称，模糊搜索" `
	ProjectCode  string `json:"projectCode" dc:"项目编码，精准搜索"`
	LeaderId     uint   `json:"leaderId" dc:"项目负责人，精准搜索"`
	EnableStatus int    `json:"enableStatus"  d:"-1" dc:"有效状态：1-有效，0-无效，（-1）-全部"`
	userId       uint
	common.CommonPaginationReq
}

func (s *ListProjectReq) SetUserId(userId uint) {
	s.userId = userId
}
func (s *ListProjectReq) GetUserId() uint {
	return s.userId
}

type ListProjectRes struct {
	Detail []*GetProjectRes `json:"detail" description:"列表"`
	Total  int64            `json:"total" description:"数据总数"`
}

type CreateProjectReq struct {
	g.Meta      `path:"/create" method:"post"`
	ProjectCode string `json:"projectCode"  dc:"项编码称" v:"required#项目编码必填，且是唯一的"  `
	ProjectName string `json:"projectName"  dc:"项目名称"   `
	ProjectUrl  string `json:"projectUrl"  dc:"项目Url"   `
	Remark      string `json:"remark" dc:"备注"    `
	userId      uint
}
type CreateProjectRes struct {
	ProjectId uint `json:"projectId" dc:"项目ID"`
}

func (s *CreateProjectReq) SetUserId(userId uint) {
	s.userId = userId
}
func (s *CreateProjectReq) GetUserId() uint {
	return s.userId
}

type SaveProjectReq struct {
	g.Meta      `path:"/save" method:"post"`
	ProjectId   uint   `json:"projectId"  dc:"项编ID" v:"required#项目ID必填"  `
	ProjectCode string `json:"projectCode"  dc:"项编码称" v:"required#项目编码必填，且是唯一的"  `
	ProjectName string `json:"projectName"  dc:"项目名称"   `
	ProjectUrl  string `json:"projectUrl"  dc:"项目Url"   `
	Remark      string `json:"remark" dc:"备注"    `
	userId      uint
}
type SaveProjectRes struct {
	ProjectId uint `json:"projectId" dc:"项目ID"`
}

func (s *SaveProjectReq) SetUserId(userId uint) {
	s.userId = userId
}
func (s *SaveProjectReq) GetUserId() uint {
	return s.userId
}

type DeleteProjectReq struct {
	g.Meta    `path:"/delete" method:"post"`
	ProjectId uint `json:"projectId"  dc:"项目Id" `
	userId    uint
}

func (s *DeleteProjectReq) SetUserId(userId uint) {
	s.userId = userId
}
func (s *DeleteProjectReq) GetUserId() uint {
	return s.userId
}

type DeleteProjectRes struct {
}
type GetProjectTreeReq struct {
	g.Meta `path:"/tree" method:"get"`
	userId uint
}

func (s *GetProjectTreeReq) SetUserId(userId uint) {
	s.userId = userId
}
func (s *GetProjectTreeReq) GetUserId() uint {
	return s.userId
}

type GetProjectTreeRes struct {
	Detail []*ProjectTreeRes `json:"detail" description:"节点"`
}
type ProjectTreeRes struct {
	Id       uint              `json:"id" description:"Id"`
	PId      uint              `json:"pId" description:"父Id"`
	Title    string            `json:"title" description:"显示Label"`
	Spread   bool              `json:"spread" description:"是否展开" d:"true"`
	Children []*ProjectTreeRes `json:"children" description:"子节点"`
}
type GetProjectComboxReq struct {
	g.Meta   `path:"/combox" method:"post"`
	AllState uint `json:"allState" description:"是否所有项目,1-是，0-否" d:"1"`
	userId   uint
}

func (s *GetProjectComboxReq) SetUserId(userId uint) {
	s.userId = userId
}
func (s *GetProjectComboxReq) GetUserId() uint {
	return s.userId
}

type GetProjectComboxRes struct {
	Detail []*ProjectComboxRes `json:"detail" description:"节点"`
}
type ProjectComboxRes struct {
	Value    uint   `json:"value" description:"Id"`
	Name     string `json:"name" description:"显示Label"`
	Selected bool   `json:"selected" description:"显示Label" d:"false"`
}
